import {redirect} from "next/navigation";
import Link from "next/link";
import {getSession} from "@/actions";

export default async function PremiumPage() {
    const session = await getSession();
    if (!session.isLoggedIn) {
        redirect("/")
    }
    if (!session.isPro) {
        return (
            <div>
                <h1>Only Premium user can see the content</h1>
                <Link href="/profile">
                    Go to the profile page to upgrade to premium
                </Link>
            </div>
        )
    }
    return (
        <div className="mt-4">
            <h1 className="text-2xl">Welcome to the PremiumPage</h1>
            <ul>
                <li>Apple</li>
                <li>Orange</li>
                <li>Peach</li>
            </ul>
        </div>
    )
}